home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / GSRC208A.ZIP / LEXYY.C < prev    next >
C/C++ Source or Header  |  1992-12-06  |  33KB  |  1,301 lines

  1. #include "copyleft.h"
  2.  
  3. /*
  4.     GEPASI - a simulator of metabolic pathways and other dynamical systems
  5.     Copyright (C) 1989, 1992  Pedro Mendes
  6. */
  7.  
  8. /*************************************/
  9. /*                                   */
  10. /*          GWTOP - Topology         */
  11. /*        MS-WINDOWS front end       */
  12. /*                                   */
  13. /*          Loops dialog box         */
  14. /*                                   */
  15. /*           QuickC/WIN 1.0          */
  16. /*                                   */
  17. /*   (include here compilers that    */
  18. /*   compiled GWSIM successfully)    */
  19. /*                                   */
  20. /*************************************/
  21.  
  22.  
  23. /* A lexical scanner generated by flex */
  24. /* version 2.3.6 for DOS */
  25. /* the header flex.ske was hacked by Pedro Mendes */
  26.  
  27. /* scanner skeleton version:
  28.  * $Header: /usr/fsys/odin/a/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp $
  29.  */
  30.  
  31. #define FLEX_SCANNER
  32.  
  33. #include <stdio.h>
  34.  
  35. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  36. #ifdef c_plusplus
  37. #ifndef __cplusplus
  38. #define __cplusplus
  39. #endif
  40. #endif
  41.  
  42. /* THIS IS A PROBLEM DUE TO LACK OF FUNCTION PROTOTYPES!!!!    */
  43. /* #pragma alloc_text( CODE2, yylex, yyreset, yy_get_next_buffer, yy_state_type yy_get_previous_state, yy_try_NUL_trans, yyunput, input, yyrestart, yy_switch_to_buffer, yy_load_buffer_state, yy_create_buffer, yy_delete_buffer, yy_init_buffer ) */
  44.  
  45. #ifdef __cplusplus
  46.  
  47. #include <stdlib.h>
  48. #include <osfcn.h>
  49.  
  50. /* use prototypes in function declarations */
  51. #define YY_USE_PROTOS
  52.  
  53. /* the "const" storage-class-modifier is valid */
  54. #define YY_USE_CONST
  55.  
  56. #else    /* ! __cplusplus */
  57.  
  58. #ifdef __STDC__
  59.  
  60. #ifdef __GNUC__
  61. #include <stddef.h>
  62. void *malloc( size_t );
  63. void free( void* );
  64. #else
  65. #include <stdlib.h>
  66. #endif    /* __GNUC__ */
  67.  
  68. #define YY_USE_PROTOS
  69. #define YY_USE_CONST
  70.  
  71. #endif    /* __STDC__ */
  72. #endif    /* ! __cplusplus */
  73.  
  74.  
  75. #ifdef __TURBOC__
  76. #define YY_USE_CONST
  77. #endif
  78.  
  79.  
  80. #ifndef YY_USE_CONST
  81. #define const
  82. #endif
  83.  
  84.  
  85. #ifdef YY_USE_PROTOS
  86. #define YY_PROTO(proto) proto
  87. #else
  88. #define YY_PROTO(proto) ()
  89. /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
  90.  * so it's got to be a K&R compiler, and therefore there's no standard
  91.  * place from which to include these definitions
  92.  */
  93. char *malloc();
  94. int free();
  95. int read();
  96. #endif
  97.  
  98.  
  99. /* amount of stuff to slurp up with each read */
  100. #ifndef YY_READ_BUF_SIZE
  101. #define YY_READ_BUF_SIZE 4096
  102. #endif
  103.  
  104. /* returned upon end-of-file */
  105. #define YY_END_TOK 0
  106.  
  107. /* copy whatever the last rule matched to the standard output */
  108.  
  109. /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
  110. /* this used to be an fputs(), but since the string might contain NUL's,
  111.  * we now use fwrite()
  112.  */
  113. #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
  114.  
  115. /* gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  116.  * is returned in "result".
  117.  */
  118. #define YY_INPUT(buf,result,max_size) \
  119.     do \
  120.     { \
  121.      strncpy( buf, yyin, max_size ); \
  122.      if ( strlen( yyin ) < max_size ) \
  123.       result=strlen( yyin ); \
  124.      else \
  125.       result=max_size; \
  126.      yyin += result; \
  127.     }while(0)
  128. #define YY_NULL 0
  129.  
  130. /* no semi-colon after return; correct usage is to write "yyterminate();" -
  131.  * we don't want an extra ';' after the "return" because that will cause
  132.  * some compilers to complain about unreachable statements.
  133.  */
  134. #define yyterminate() return ( YY_NULL )
  135.  
  136. /* report a fatal error */
  137.  
  138. /* The funky do-while is used to turn this macro definition into
  139.  * a single C statement (which needs a semi-colon terminator).
  140.  * This avoids problems with code like:
  141.  *
  142.  *     if ( something_happens )
  143.  *        YY_FATAL_ERROR( "oops, the something happened" );
  144.  *    else
  145.  *        everything_okay();
  146.  *
  147.  * Prior to using the do-while the compiler would get upset at the
  148.  * "else" because it interpreted the "if" statement as being all
  149.  * done when it reached the ';' after the YY_FATAL_ERROR() call.
  150.  */
  151.  
  152. #define YY_FATAL_ERROR(msg) \
  153.     do \
  154.         { \
  155.         (void) fputs( msg, stderr ); \
  156.         (void) putc( '\n', stderr ); \
  157.         exit( 1 ); \
  158.         } \
  159.     while ( 0 )
  160.  
  161. /* default yywrap function - always treat EOF as an EOF */
  162. #define yywrap() 1
  163.  
  164. /* enter a start condition.  This macro really ought to take a parameter,
  165.  * but we do it the disgusting crufty way forced on us by the ()-less
  166.  * definition of BEGIN
  167.  */
  168. #define BEGIN yy_start = 1 + 2 *
  169.  
  170. /* action number for EOF rule of a given start state */
  171. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  172.  
  173. /* special action meaning "start processing a new file" */
  174. #define YY_NEW_FILE \
  175.     do \
  176.         { \
  177.         yy_init_buffer( yy_current_buffer, yyin ); \
  178.         yy_load_buffer_state(); \
  179.         } \
  180.     while ( 0 )
  181.  
  182. /* default declaration of generated scanner - a define so the user can
  183.  * easily add parameters
  184.  */
  185. #define YY_DECL int yylex YY_PROTO(( void ))
  186.  
  187. /* code executed at the end of each rule */
  188. #define YY_BREAK break;
  189.  
  190. #define YY_END_OF_BUFFER_CHAR 0
  191.  
  192. #ifndef YY_BUF_SIZE
  193. #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
  194. #endif
  195.  
  196. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  197.  
  198. #define YY_CHAR char
  199. #define INITIAL 0
  200. /* scanner for arithmetic expressions */
  201. /* the generated file MUST have the macro YY_FATAL_ERROR edited  */
  202. /* in order to point ot an externaly defined function that sends */
  203. /* the error messages through a message box (and not via printf) */
  204. #include <string.h>
  205. #include <math.h>
  206.  
  207. struct nodet{
  208.              char item;
  209.              unsigned char val;
  210.              unsigned char left;
  211.              unsigned char right;
  212.             } ;
  213.  
  214. struct treet{
  215.              struct nodet node[256];
  216.              char id[64][10];
  217.              float constant[32];
  218.              int nnode,
  219.                  nnum,
  220.                  nid,
  221.                  nsub,
  222.                  npro,
  223.                  nmodf,
  224.                  nconst,
  225.                  revers;
  226.              char descr[64];
  227.             } ;
  228.  
  229. extern    char            errstr[80];                /* string to hold lex and parser errors    */
  230. extern    unsigned char    lex;                    /* index for parser                        */
  231. extern  struct treet    tr;
  232. extern  int             errfl;
  233.  
  234. int lexyy_fatal( char *m );
  235. #define YY_FATAL_ERROR(msg) \
  236.     do \
  237.         { \
  238.         (void) lexyy_fatal( msg ); \
  239.         return YY_NULL; \
  240.         } \
  241.     while ( 0 )
  242.  
  243. int k;
  244. float faux;
  245.  
  246. /* done after the current pattern has been matched and before the
  247.  * corresponding action - sets up yytext
  248.  */
  249. #define YY_DO_BEFORE_ACTION \
  250.     yytext = yy_bp; \
  251.     yyleng = yy_cp - yy_bp; \
  252.     yy_hold_char = *yy_cp; \
  253.     *yy_cp = '\0'; \
  254.     yy_c_buf_p = yy_cp;
  255.  
  256. #define EOB_ACT_CONTINUE_SCAN 0
  257. #define EOB_ACT_END_OF_FILE 1
  258. #define EOB_ACT_LAST_MATCH 2
  259.  
  260. /* return all but the first 'n' matched characters back to the input stream */
  261. #define yyless(n) \
  262.     do \
  263.         { \
  264.         /* undo effects of setting up yytext */ \
  265.         *yy_cp = yy_hold_char; \
  266.         yy_c_buf_p = yy_cp = yy_bp + n; \
  267.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  268.         } \
  269.     while ( 0 )
  270.  
  271. #define unput(c) yyunput( c, yytext )
  272.  
  273.  
  274. struct yy_buffer_state
  275.     {
  276.     char *yy_input_file;
  277.  
  278.     YY_CHAR *yy_ch_buf;        /* input buffer */
  279.     YY_CHAR *yy_buf_pos;    /* current position in input buffer */
  280.  
  281.     /* size of input buffer in bytes, not including room for EOB characters*/
  282.     int yy_buf_size;
  283.  
  284.     /* number of characters read into yy_ch_buf, not including EOB characters */
  285.     int yy_n_chars;
  286.  
  287.     int yy_eof_status;        /* whether we've seen an EOF on this buffer */
  288. #define EOF_NOT_SEEN 0
  289.     /* "pending" happens when the EOF has been seen but there's still
  290.      * some text process
  291.      */
  292. #define EOF_PENDING 1
  293. #define EOF_DONE 2
  294.     };
  295.  
  296. static YY_BUFFER_STATE yy_current_buffer;
  297.  
  298. /* we provide macros for accessing buffer states in case in the
  299.  * future we want to put the buffer states in a more general
  300.  * "scanner state"
  301.  */
  302. #define YY_CURRENT_BUFFER yy_current_buffer
  303.  
  304.  
  305. /* yy_hold_char holds the character lost when yytext is formed */
  306. static YY_CHAR yy_hold_char;
  307.  
  308. static int yy_n_chars;        /* number of characters read